package first.spring.community.interceptors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
//去掉了@EnableWebMva
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private  SessionInterceptor sessionInterceptor;
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor( sessionInterceptor).addPathPatterns("/**");
}

}
//add.PathPatterns("/**")拦截
//excludePathPatterns("/admin/**")略过